package cn.melonlib.cores.aop.comp.config;

import cn.hutool.core.bean.BeanUtil;
import cn.melonlib.cores.commons.anno.ConfigBean;
import cn.melonlib.cores.commons.comp.dao.DatabaseConfig;
import cn.melonlib.objects.maps.JsonMap;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@ConfigBean(name = "databaseConfig")
public class DatabaseConfigReader {

    @Resource
    private DatabaseConfig databaseConfig;

    public JsonMap<Object> config(){
        JsonMap<Object> jsonMap=JsonMap.createMap();
        BeanUtil.copyProperties(this.databaseConfig, jsonMap,"$$beanFactory");
        return jsonMap;
    }
}
